/*
 * @Copyright: 2023 - 2023 www.hoperun.com Inc. All rights reserved.
 */

package com.lifeservice.common.utils;

import java.awt.*;
import java.util.Random;

/**
 * @author liu_yifeng
 * @function ColorUtils
 * @date 2023/3/21 10:12
 */
public class ColorUtils {
    public static String getRandomHexColor(){
        Random random = new Random();
        float hue = random.nextFloat();
        float sat = (random.nextInt(2000)+1000)/10000f;
        float lum = 0.9f;
        Color color = Color.getHSBColor(hue,sat,lum);
        String result = "#"+Integer.toHexString(color.getRGB() & 0xffffff | 0x1000000).substring(1);
        return result.toUpperCase();
    }
}
